// User.java
import java.util.ArrayList;
import java.util.List;

public class User {
    private String userId;
    private String name;
    private String phone;
    private List<Book> borrowedBooks;

    public User(String userId, String name, String phone) {
        this.userId = userId;
        this.name = name;
        this.phone = phone;
        this.borrowedBooks = new ArrayList<>();
    }

    // Getter和Setter方法
    public String getUserId() { return userId; }
    public String getName() { return name; }
    public String getPhone() { return phone; }
    public List<Book> getBorrowedBooks() { return borrowedBooks; }

    public void borrowBook(Book book) {
        borrowedBooks.add(book);
    }

    public void returnBook(Book book) {
        borrowedBooks.remove(book);
    }

    @Override
    public String toString() {
        return String.format("%s (%s) - %s", name, userId, phone);
    }
}